<?php

namespace app\admin\validate;

use think\facade\Request;
use think\Validate;
use app\common\Error;

class Banner extends Validate
{
    protected $rule = [
        'id' => 'require',
        'video_id' => 'requireIf:type,jump',
        'path' => 'require',
        'sort' => 'require',
        'type' => 'require',
        'activity_id' => 'requireIf:type,activity',
    ];

    protected $message = [
        'id.require' => Error::ID_NOT_EXIXTS,
        'video_id.requireIf' => '短剧不能为空',
        'path.require' => Error::PATH_NOT_EXIXTS,
        'sort.require' => Error::SORT_NOT_EXIXTS,
        'type.require' => '类型不能为空',
        'activity_id.requireIf' => '活动不能为空',
    ];

    protected $scene = [
        'add' => ['path', 'sort', 'type', 'video_id', 'activity_id'],
        'edit' => ['id', 'path', 'sort', 'type', 'video_id', 'activity_id'],
        'delete' => ['id'],
        'detail' => ['id'],
    ];
}